Skip to content

Update clang-format to 22.1.0#2

Open
hannesbraun wants to merge 2 commits intoHSOAutonomy:masterfrom
hannesbraun:clang-format-22
Open

Update clang-format to 22.1.0#2
hannesbraun wants to merge 2 commits intoHSOAutonomy:masterfrom
hannesbraun:clang-format-22

Conversation

@hannesbraun
Copy link
Contributor

This adds support for some "new" Java language features such as switch expressions.

I noticed that the new release would reformat quite a bit of existing code. Most of the changes were just breaking string literals apart. So I adjusted our clang-format template as well to add the rule that string literals should be kept. I also think this makes sense in general as strings can easier be searched for in the project.

Some notes on the binaries:

  • For Windows, I took the one provided by LLVM on their release page.
  • For macOS, it's still self-built on and for the amd64 architecture. But as far as I know, this should still run fine on more modern machines with an ARM processor.
  • For macOS and Linux, I adjusted the build a little in order to reduce the amount of dependencies (dynamically loaded libraries). More dependencies are only increasing the likeliness of a breakage at some point. Namely, I added these CMake options: -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_ENABLE_THREADS=OFF. Especially the zlib and zstd options were not available in previous releases (as far as I know).
  • For Linux, the binary was built within a current Ubuntu 24.04 environment with a minimal patch (see below). This allows the binary to run on Alpine Linux (my distribution of choice) with the gcompat package as well.

This is the patch that I applied for the Linux build:

diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index ed2bfa6df68f..ed2d1328db31 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -342,6 +342,7 @@ endif()
 
 # function checks
 check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM)
+set(HAVE_DECL_ARC4RANDOM FALSE)
 find_package(Backtrace)
 set(HAVE_BACKTRACE ${Backtrace_FOUND})
 set(BACKTRACE_HEADER ${Backtrace_HEADER})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant